<template>
    <div>
        <!-- 售票 -->
        <!-- 功能栏 -->
        <el-row>
            <el-col :span="18">
                <ul class="fun-ul">
                    <li @click="toGet">取票</li>
                    <li class="tag">|</li>
                    <li @click="toUnCash">非现金支付订单</li>
                    <li class="tag">|</li>
                    <li @click="toSell">售票明细</li>
                    <li class="tag">|</li>
                    <li @click="toSum">售票汇总</li>
                    <li class="tag">|</li>
                    <li @click="toBack">退票</li>
                    <li class="tag">|</li>
                    <li @click="toAban">废票</li>
                    <li class="tag">|</li>
                    <li @click="toEndorse">改签</li>
                    <li class="tag">|</li>
                    <li @click="toBuyTic">补票</li>
                    <li class="tag">|</li>
                    <li @click="toTicSear">票号查询</li>
                    <li class="tag">|</li>
                    <li @click="toSaleTic">售优惠券</li>
                </ul>
            </el-col>
        </el-row>
        <!--  补票弹窗  S-->
        <div class="modalPosition" v-if="modalPosition"></div>
        <div class="ticModal" v-if="ticModal">
            <div @click="closeTicModal" class="close-ticModal">X</div>
            <div class="ticModal-top">
                <div class="ticModal-topLeft lf">
                    <div class="left-choose">
                        <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf">
                        <div class="lf title" style="color: #009688;padding-left: 5px;">补票面板</div>
                    </div>
                    <div class="buyTic">
                        <div class="buytic-btn lf">补票</div>
                        <div class="riding-date lf">
                            <span>乘车日期</span>
                            <el-date-picker style="font-size: 14px;" v-model="dateValue" size="mini" type="date"
                                            placeholder="选择日期"></el-date-picker>
                            <span style="color:#009688;font-size: 14px;padding-left: 1px;">{{this.tagDateVal}}</span>
                        </div>
                    </div>
                    <div class="fill-txt">
                        <el-form ref="form" style="overflow:hidden;">
                            <el-col :span="4">
                                <el-form-item label="到站" label-width="40px" class="lf" style="margin-left: 10px;">
                                    <el-autocomplete style="width: 130px" v-model="endStation" size="mini"
                                                     :fetch-suggestions="queryCardCode" id="daoZhanR"></el-autocomplete>
                                </el-form-item>
                            </el-col>
                            <el-form-item label="半票" label-width="70px" class="lf" style="margin-left: 50px;">
                                <el-input v-model="halfTic" style='width: 80px;' size="mini"></el-input>
                                <span>张</span>
                            </el-form-item>
                            <el-form-item label="收款" label-width="70px" class="lf" style="margin-left: 20px;">
                                <el-input v-model="makeCollec" style='width: 88px;' size="mini"></el-input>
                            </el-form-item>
                            <el-form-item label="免费儿童" label-width="70px" class="lf" style="margin-left: 5px;">
                                <el-input v-model="freeChil" style='width: 80px;' size="mini"></el-input>
                                <span>名</span>
                            </el-form-item>
                            <el-form-item label="回程票" label-width="70px" class="lf" style="margin-left: 20px;">
                                <el-input v-model="returnTic" style='width: 80px;' size="mini"></el-input>
                                <span>张</span>
                            </el-form-item>
                            <el-form-item label="全票" label-width="50px" class="lf">
                                <el-input v-model="fullTic" style='width: 80px;' size="mini"></el-input>
                                <span>张</span>
                            </el-form-item>
                            <el-form-item label="应收" label-width="50px" class="lf" style="margin-left: 0px;">
                                <el-input v-model="receivable" style='width: 80px;' size="mini"></el-input>
                                <span>元</span>
                            </el-form-item>
                            <el-form-item label="应找" label-width="70px" class="lf" style="margin-left: 20px;">
                                <el-input v-model="reback" style='width: 80px;' size="mini"></el-input>
                                <span>元</span>
                            </el-form-item>
                        </el-form>
                        <div style="overflow: hidden;margin: 0px 0 0 6px;">
                            <div class="jiaoyi lf"><span>上笔交易：<span>6</span>张</span></div>
                            <div class="jiaoyi lf" style="margin: 0 15px;"><span>上笔收款：<span>96</span>元</span></div>
                            <div class="jiaoyi lf"><span>应找：<span>6</span>元</span></div>
                            <div class="jiaoyi lf" style="margin: 0 15px;"><span>班次备注：<span>写点什么。。。。</span></span></div>
                        </div>

                    </div>
                </div>
                <!--  右侧数据 S -->
                <div class="ticModal-topRight lf" id="busList">
                    <!-- <el-row style="width: 100%" class="lf">
                         <el-col :span="24">
                             <avue-crud @current-change="rowChangeTic" :data='objs' v-model="bearFruit" :page="ticPage" :option="dataForm"></avue-crud>
                         </el-col>
                     </el-row>-->
                </div>
                <!--  右侧数据 E -->
            </div>

            <div class="ticModal-bottom">
                <div class="ticDataShow lf">
                    <el-row style="width: 100%" class="lf">
                        <el-col :span="24">
                            <avue-crud @current-change="rowChangeData" :data='objDataShow' v-model="bearDataShow"
                                       :page="ticDataShowPage" :option="dataDataShowForm"></avue-crud>
                        </el-col>
                    </el-row>
                </div>

                <div class="ticDataRight lf">
                    <div class="ticDataRight-top">
                        选座:<input type="text" placeholder="" readonly>
                    </div>
                    <div class="ticDataRight-center">
                        <span>当前票号：<span>29号</span></span>
                        <span style="padding-left: 15px;">余票：<span>12张</span></span>
                    </div>
                    <div class="ticDataRight-bottom">
                        <ul>
                            <li title="可售"></li>
                            <li title="已售" class="right-icon1"></li>
                            <li title="停售" class="right-icon2"></li>
                            <li title="留位" class="right-icon3"></li>
                            <li title="锁位" class="right-icon4"></li>
                            <li title="配客" class="right-icon5"></li>
                            <li title="预定" class="right-icon6"></li>
                        </ul>
                    </div>
                    <div class="seat-icon">
                        <ul>
                            <li class="seat-icon1">1</li>
                            <li class="seat-icon1 active-seat">2</li>
                            <li class="seat-icon1">3</li>
                            <li class="seat-icon1">4</li>
                            <li class="seat-icon1">5</li>
                            <li class="seat-icon1 active-seat">6</li>
                            <li class="seat-icon1">7</li>
                            <li class="seat-icon1">8</li>
                            <li class="seat-icon1">9</li>
                            <li class="seat-icon1 active-seat">10</li>
                            <li class="seat-icon1">11</li>
                            <li class="seat-icon1">12</li>
                            <li class="seat-icon1">13</li>
                            <li class="seat-icon1 active-seat">14</li>
                            <li class="seat-icon1">15</li>
                            <li class="seat-icon1">16</li>
                            <li class="seat-icon1">17</li>
                            <li class="seat-icon1 active-seat">18</li>
                            <li class="seat-icon1">19</li>
                            <li class="seat-icon1">20</li>
                            <li class="seat-icon1">21</li>
                            <li class="seat-icon1 active-seat">22</li>
                            <li class="seat-icon1">23</li>
                            <li class="seat-icon1">24</li>
                            <li class="seat-icon1">25</li>
                            <li class="seat-icon1 active-seat">26</li>
                            <li class="seat-icon1">27</li>
                            <li class="seat-icon1">28</li>
                            <li class="seat-icon1">29</li>
                            <li class="seat-icon1 active-seat">30</li>
                            <li class="seat-icon1">31</li>
                            <li class="seat-icon1">32</li>
                            <li class="seat-icon1">33</li>
                            <li class="seat-icon1 active-seat">34</li>
                            <li class="seat-icon1">35</li>
                            <li class="seat-icon1">36</li>
                            <li class="seat-icon1">37</li>
                            <li class="seat-icon1 active-seat">38</li>
                            <li class="seat-icon1">39</li>
                            <li class="seat-icon1">40</li>
                            <li class="seat-icon1">41</li>
                            <li class="seat-icon1 active-seat">42</li>
                            <li class="seat-icon1">43</li>
                            <li class="seat-icon1">44</li>
                            <li class="seat-icon1">45</li>
                            <li class="seat-icon1 active-seat">46</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <!--  补票弹窗  E-->

        <!--改签面板 S-->
        <div class="endorseModal" v-if="endorseModal"></div>
        <div class="endorse" v-if="ticEndorse">
            <div @click="closeTicModal" class="close-ticModal">X</div>
            <div class="endorse-left lf">

                <div class="endorse-left-top">
                    <div class="left-choose" style="overflow: hidden;margin-bottom: 15px;">
                        <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf">
                        <div class="lf title" style="padding-left: 5px;color: #009688;">改签面板</div>
                    </div>
                    <div class="endorse-con">
                        <div class="endorse-btn lf">改签</div>
                        <div class="endorse-conright lf">
                            <div class="lf">
                                <span style="font-size: 14px;margin-right: 13px;">乘车日期</span>
                                <el-date-picker style="font-size: 14px;" v-model="endorseValue" size="mini" type="date"
                                                placeholder="选择日期"></el-date-picker>
                                <span style="color:#009688;font-size: 14px;padding-left: 1px;">{{this.tagDateEndorse}}</span>
                            </div>

                            <el-form ref="form" class="lf" style="overflow:hidden;">
                                <el-col :span="4">
                                    <el-form-item label="到站" label-width="40px" class="lf"
                                                  style="margin:-6px 0 0 20px;">
                                        <el-autocomplete style="width: 160px" v-model="endorseStation" size="mini"
                                                         :fetch-suggestions="queryCardStation"></el-autocomplete>
                                    </el-form-item>
                                </el-col>
                            </el-form>
                            <el-form ref="form" class="lf" style="width:100%;overflow:hidden;">
                                <el-form-item label="改签座位" label-width="70px" class="lf">
                                    <el-input v-model="endorseSeat" style='width: 245px !important;'
                                              size="mini"></el-input>
                                </el-form-item>
                                <el-form-item label="票号" label-width="70px" class="lf" style="margin-left: 25px;">
                                    <input @keydown.13="submit()" v-model="endorseNum" type="text" placeholder=""
                                           id="ketInput">
                                    <!--<el-input @keydown.enter="submit()" v-model="endorseNum" style='width: 160px;' size="mini"></el-input>-->
                                </el-form-item>
                            </el-form>
                        </div>
                        <div class="endorse-txt lf">
                            <div class="lf" style="margin-right: 40px;">原班次：<span>{{this.tbc_bus_date}}&nbsp;{{this.tbc_bus_id}}</span>
                            </div>
                            <div class="lf" style="margin-right: 40px;">座号：<span>{{this.seatno}}</span></div>
                            <div class="lf">票价：<span>{{this.endorsePrice}}</span>元</div>
                            <button @click="sureEndorse">确认改签</button>
                        </div>
                    </div>
                </div>

                <div class="endorse-left-bottom">
                    <el-row style="width: 100%" class="lf">
                        <el-col :span="24">
                            <avue-crud @current-change="rowChangeData" :data='objDataShow' v-model="bearDataShow"
                                       :page="ticDataShowPage" :option="dataDataShowForm"></avue-crud>
                        </el-col>
                    </el-row>
                </div>
            </div>

            <div class="endorse-right lf">
                <div class="ticDataRight-top">
                    选座:<input type="text" placeholder="" readonly>
                </div>
                <div class="ticDataRight-center">
                    <span>当前票号：<span>29号</span></span>
                    <span style="padding-left: 15px;">余票：<span>12张</span></span>
                </div>
                <div class="ticDataRight-bottom">
                    <ul>
                        <li title="可售"></li>
                        <li title="已售" class="right-icon1"></li>
                        <li title="停售" class="right-icon2"></li>
                        <li title="留位" class="right-icon3"></li>
                        <li title="锁位" class="right-icon4"></li>
                        <li title="配客" class="right-icon5"></li>
                        <li title="预定" class="right-icon6"></li>
                    </ul>
                </div>
                <div class="seat-icon">
                    <ul>
                        <li class="seat-icon1">1</li>
                        <li class="seat-icon1 active-seat">2</li>
                        <li class="seat-icon1">3</li>
                        <li class="seat-icon1">4</li>
                        <li class="seat-icon1">5</li>
                        <li class="seat-icon1 active-seat">6</li>
                        <li class="seat-icon1">7</li>
                        <li class="seat-icon1">8</li>
                        <li class="seat-icon1">9</li>
                        <li class="seat-icon1 active-seat">10</li>
                        <li class="seat-icon1">11</li>
                        <li class="seat-icon1">12</li>
                        <li class="seat-icon1">13</li>
                        <li class="seat-icon1 active-seat">14</li>
                        <li class="seat-icon1">15</li>
                        <li class="seat-icon1">16</li>
                        <li class="seat-icon1">17</li>
                        <li class="seat-icon1 active-seat">18</li>
                        <li class="seat-icon1">19</li>
                        <li class="seat-icon1">20</li>
                        <li class="seat-icon1">21</li>
                        <li class="seat-icon1 active-seat">22</li>
                        <li class="seat-icon1">23</li>
                        <li class="seat-icon1">24</li>
                        <li class="seat-icon1">25</li>
                        <li class="seat-icon1 active-seat">26</li>
                        <li class="seat-icon1">27</li>
                        <li class="seat-icon1">28</li>
                        <li class="seat-icon1">29</li>
                        <li class="seat-icon1 active-seat">30</li>
                        <li class="seat-icon1">31</li>
                        <li class="seat-icon1">32</li>
                        <li class="seat-icon1">33</li>
                        <li class="seat-icon1 active-seat">34</li>
                        <li class="seat-icon1">35</li>
                        <li class="seat-icon1">36</li>
                        <li class="seat-icon1">37</li>
                        <li class="seat-icon1 active-seat">38</li>
                        <li class="seat-icon1">39</li>
                        <li class="seat-icon1">40</li>
                        <li class="seat-icon1">41</li>
                        <li class="seat-icon1 active-seat">42</li>
                        <li class="seat-icon1">43</li>
                        <li class="seat-icon1">44</li>
                        <li class="seat-icon1">45</li>
                        <li class="seat-icon1 active-seat">46</li>
                    </ul>
                </div>
            </div>
        </div>
        <!--改签面板 E-->


        <!-- 信息栏 -->
        <el-row class="msg1-container">
            <!-- 左侧表单 -->
            <el-col :span="12">
                <el-row>
                    <el-col :span="24" class="sell-form-container">
                        <avue-form v-model="classMsg" :option="classOption" class="yz-form" id="msgForm"></avue-form>
                    </el-col>
                </el-row>

            </el-col>
            <!-- 右侧表格 -->
            <el-col :span="12" class="sell-right-table">
                <avue-crud :data="msgList[0].data" :option="msgList[0].option" class="rig-table"></avue-crud>
            </el-col>
        </el-row>
        <!-- 详情表格栏 -->
        <el-row class="detail2-container">
            <!-- 左侧表格栏 -->
            <el-col :span="18" class="left-table">
                <avue-crud :data="detailsList[0].data" :option="detailsList[0].option"></avue-crud>
            </el-col>
            <!-- 右侧图 -->
            <el-col :span="5" class="right-img"></el-col>
        </el-row>
        <!-- 弹窗 -->
        <div class="modal-win" v-show="modualShow">
            <!-- 标题 -->
            <el-row>
                <el-col :span="24">
                    <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf modal-img">
                    <div class="lf modal-title">{{modalTitle}}</div>
                    <div class="rf close" @click="closeModual">X</div>
                </el-col>
            </el-row>
            <!-- 信息栏 -->
            <el-row>
                <el-col :span="24">
                    <div class="msg-win">
                        <!-- 取票 -->
                        <div v-show="modalTitle==='取票'">
                            <div class="msg-get-form">
                                <avue-form v-model="getTicket" :option="getOption"
                                           class="get-form-container"></avue-form>
                                <button class="check-btn rf" @click="cancel"><img
                                        src="../../assets/imgs/operation_btn_icon_quxiao_default.png" alt=""
                                        class="btn-img">
                                    取消
                                </button>
                                <button class="check-btn rf" @click="check"><img
                                        src="../../assets/imgs/operation_btn_icon_chaxun_default.png" alt=""
                                        class="btn-img">
                                    查询
                                </button>
                                <div class="cb"></div>
                            </div>
                            <!-- <avue-crud :data="TicketTable[0].data" :option="TicketTable[0].option" class="get-table" height="250"></avue-crud> -->
                            <el-table
                                    :data="TicketTable[0].data"
                                    height="230"
                                    border
                                    style="width: 100%" class="get-table">
                                <el-table-column
                                        prop="expand"
                                        label="" type="expand">
                                    <template slot-scope="props">
                                        <table style="width:100%">
                                            <tr>
                                                <td>到站</td>
                                                <td>班次号</td>
                                                <td>班次日期</td>
                                                <td>班次时间</td>
                                                <td>座位号</td>
                                                <td>票价</td>
                                                <td>状态</td>
                                                <td>条码号</td>
                                                <td>姓名</td>
                                                <td>证件号码</td>
                                            </tr>
                                            <tr>
                                                <td>{{props.row.start_station}}</td>
                                                <td>{{props.row.bus_id}}</td>
                                                <td>{{props.row.bus_date}}</td>
                                                <td>{{props.row.bus_time}}</td>
                                                <td>{{props.row.seatno}}</td>
                                                <td>{{props.row.fare}}</td>
                                                <td>{{props.row.order_status}}</td>
                                                <td></td>
                                                <td>{{props.row.tk_holder_name}}</td>
                                                <td>{{props.row.tk_holder_cert_no}}</td>
                                            </tr>
                                        </table>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        prop="opc"
                                        label="操作">
                                    <template slot-scope="scope">
                                        <button @click="quPiao(scope.row.start_station,scope.row.order_no,scope.row.id)">
                                            取票
                                        </button>
                                    </template>
                                </el-table-column>
                                <el-table-column
                                        prop="order_no"
                                        label="订单号">
                                </el-table-column>
                                <el-table-column
                                        prop="order_status"
                                        label="订单状态">
                                </el-table-column>
                                <el-table-column
                                        prop="order_type"
                                        label="业务类型">
                                </el-table-column>
                                <el-table-column
                                        prop="total_num"
                                        label="票数">
                                </el-table-column>
                                <el-table-column
                                        prop="payee_sumno"
                                        label="票款">
                                </el-table-column>
                                <el-table-column
                                        prop="tk_holder_phone"
                                        label="手机号">
                                </el-table-column>
                                <el-table-column
                                        prop="tk_holder_pwd"
                                        label="证件号">
                                </el-table-column>

                            </el-table>
                        </div>
                        <!-- 非现金支付订单 -->
                        <div v-show="modalTitle==='非现金支付订单'">
                            <el-row>
                                <el-col :span="24" class="table-fun">
                                    <img src="../../assets/imgs/operation_icon_shuaxin_default.png" alt="" class="lf">
                                    <div class="lf choose-title fun-text" @click="Payrefresh">刷新列表</div>
                                    <img src="../../assets/imgs/operation_bg_sousuo_default.png" alt="" class="lf">
                                    <div class="lf choose-title fun-text">查询订单状态</div>
                                    <img src="../../assets/imgs/operation_icon_tuihuan_default.png" alt="" class="lf">
                                    <div class="lf choose-title fun-text">异常退款</div>
                                </el-col>
                            </el-row>
                            <TableData :data="payTable[0].data" :option="payTable[0].option"
                                       :rowChange="rowChange"></TableData>
                        </div>
                        <!-- 销售明细 -->
                        <div v-show="modalTitle==='售票明细'">
                            <el-row>
                                <el-col :span="24" class="table-fun">
                                    <img src="../../assets/imgs/operation_icon_dayin_default.png" alt="" class="lf">
                                    <div class="lf choose-title fun-text" @click="rePrint">重打最后一批次售出的车票</div>
                                    <img src="../../assets/imgs/operation_icon_piaojia_default.png" alt="" class="lf">
                                    <div class="lf choose-title fun-text">退保最后一批售出车票</div>
                                </el-col>
                            </el-row>
                            <avue-crud :data="sellTable[0].data" :option="sellTable[0].option"
                                       @current-row-change="rowChangeSell" class="sell-table"></avue-crud>
                        </div>
                        <!-- 销售汇总 -->
                        <div v-show="modalTitle==='售票汇总'">
                            <el-row>
                                <el-col :span="24">
                                    <button class="check-btn rf" @click="checkSum"><img
                                            src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt=""
                                            class="btn-img">查询
                                    </button>
                                    <avue-form v-model="sellSum" :option="sumOption" class="sum "></avue-form>
                                </el-col>
                            </el-row>
                            <div class="sum-text" id="sumDIV">当前日期没有售票记录</div>
                        </div>
                        <!-- 退票面板 -->
                        <div v-show="modalTitle==='退票面板'">
                            <el-tabs v-model="abanTicket">
                                <el-tab-pane label="按票段" name="first" class="duan-container">
                                    <avue-form v-model="backTicOnDuan" :option="backTicODOption" class="backTic"
                                               id="tuiForm"></avue-form>
                                    <button class="check-btn duan-btn" @click="backTic">退票</button>
                                    <avue-crud :data="backDuanTable[0].data"
                                               :option="backDuanTable[0].option" v-model="tuiObj" @current-row-change="rowChange1"></avue-crud>
                                </el-tab-pane>
                                <el-tab-pane label="按班次" name="second" class="class-container">
                                    <avue-form v-model="backTicOnClass" :option="backTicCOption" class="backTic"
                                               id="tuiForm"></avue-form>
                                    <button class="check-btn class-btn" @click="backTic">退票</button>
                                    <avue-crud :data="backDuanTable[0].data" :option="backDuanTable[0].option"
                                               @current-row-change="rowChange" v-model="tuiObj"></avue-crud>
                                </el-tab-pane>
                            </el-tabs>
                        </div>
                        <!-- 废票面板 -->
                        <el-tabs v-model="abanTicket" v-show="modalTitle==='废票面板'">
                            <el-tab-pane label="按票段" name="first" class="duan-container">
                                <avue-form v-model="abanTicOnDuan" :option="abanTicODOption" class="backTic"
                                           id="feiForm"></avue-form>
                                <button class="check-btn duan-btn" @click="babanTic">废票</button>
                                <avue-crud :data="backDuanTable[0].data" :option="backDuanTable[0].option"
                                           @current-row-change="rowChange"></avue-crud>
                            </el-tab-pane>
                            <el-tab-pane label="按班次" name="second" class="class-container">
                                <avue-form v-model="abanOnClass" :option="abanTicCOption" class="backTic"
                                           id="feiForm"></avue-form>
                                <button class="check-btn duan-btn" @click="babanTic">废票</button>
                                <avue-crud :data="backDuanTable[0].data" :option="backDuanTable[0].option"
                                           @current-row-change="rowChange"></avue-crud>
                            </el-tab-pane>
                        </el-tabs>
                        <!-- 销售优惠券 -->
                        <div v-show="modalTitle==='销售优惠券'">
                            <el-row class="sale-container">
                                <el-col :span="24">
                                    <FormData :ob="saleTicket" :op="saleTicOption" class="sale-form"></FormData>
                                    <button class="check-btn sale-btn">读身份证</button>
                                </el-col>
                            </el-row>
                            <el-row class="sale-container">
                                <el-col :span="24">
                                    <FormData :ob="saleTicketII" :op="saleTicOptionII"></FormData>
                                    <button class="check-btn rf" @click="closeSaleWin"><img
                                            src="../../assets/imgs/operation_btn_icon_quxiao_default.png" alt=""
                                            class="btn-img">取消
                                    </button>
                                    <button class="check-btn rf" @click="sendSale"><img
                                            src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt=""
                                            class="btn-img">提交
                                    </button>
                                </el-col>
                            </el-row>
                        </div>
                    </div>
                </el-col>
            </el-row>
        </div>
        <!-- 票号查询弹窗 -->
        <div v-show="modalTitle === '票号查询'" class="modal-tick-win">
            <el-row>
                <el-col :span="24">
                    <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf modal-img">
                    <div class="lf modal-title">{{modalTitle}}</div>
                    <div class="rf close" @click="closeSearch">X</div>
                </el-col>
            </el-row>
            <el-row class="search-container">
                <el-col :span="24">
                    <el-input
                            placeholder="请输入内容"
                            v-model="searchInput">
                        <i
                                class="el-icon-search el-input__icon searchIcon"
                                slot="suffix"
                                @click="handleSearch">
                        </i>
                    </el-input>
                    <div id="checkContent"></div>
                </el-col>
            </el-row>
        </div>
        <!-- 进入弹窗 -->
        <div class="modal-tick-win" v-show="printWin">
            <el-form ref="form" :model="printForm" label-width="180px">
                <el-form-item label="选择身份证阅读器">
                    <el-select v-model="printForm.IDRead" placeholder="">
                        <el-option label="无" value="none"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="选择车票打印机">
                    <el-select v-model="printForm.ticPrint" placeholder="">
                        <el-option v-for="item of ticPrintList" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="选择票段">
                    <el-select v-model="printForm.tickDuan" placeholder="">
                        <el-option v-for="item of ticDuanList" :label="item.text" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="顾客屏编号">
                    <el-input v-model="printForm.cusID"></el-input>
                </el-form-item>
                <el-form-item>
                    <button class="check-btn" @click="sure" type="button">确认</button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
    import FormData from "../../components/common/form";
    import TableData from "../../components/common/tableData";
    import qs from "qs";

    const DIC = {
        station: [],
        stations: [],
        ticSta: [],
        sex: [
            {
                label: "男",
                value: 1
            },
            {
                label: "女",
                value: 0
            }
        ]
    };
    export default {
        data: function () {
            return {
                backTicId : '',
                backTicRetuRate : '',
                backTicPrice :'',
                backTicRate :'',
                printWin: true,
                printForm: {
                    IDRead: "",
                    ticPrint: "",
                    tickDuan: "",
                    cusID: ""
                },
                ticPrintList: [],
                ticDuanList: [],
                seatno: "",
                endorsePrice: "",
                tbc_bus_date: "",
                tbc_bus_id: "",
                ticket_id: "",
                endorseValue: "",
                endorseSeat: "",
                endorseNum: "",
                ticEndorse: false,
                modalPosition: false,
                endorseModal: false,
                classMsg: {},
                buyTicMsg: {},
                bearFruit: {},
                bearDataShow: {},
                objs: [
                    {
                        sequence: "1", //序号
                        ticDate: "2018", //日期
                        ticTime: "13.14", //时间
                        ticBanClass: "YHGDGZ1120", //班次
                        ticSeat: "2", //座位
                        ticStyle: "全票", //票型
                        ticPrice: "70.00", //票价
                        ticsTayion: "广州（省站" //站点
                    },
                    {
                        sequence: "1", //序号
                        ticDate: "2018", //日期
                        ticTime: "13.14", //时间
                        ticBanClass: "YHGDGZ1120", //班次
                        ticSeat: "2", //座位
                        ticStyle: "全票", //票型
                        ticPrice: "70.00", //票价
                        ticsTayion: "广州（省站" //站点
                    },
                    {
                        sequence: "1", //序号
                        ticDate: "2018", //日期
                        ticTime: "13.14", //时间
                        ticBanClass: "YHGDGZ1120", //班次
                        ticSeat: "2", //座位
                        ticStyle: "全票", //票型
                        ticPrice: "70.00", //票价
                        ticsTayion: "广州（省站" //站点
                    },
                    {
                        sequence: "1", //序号
                        ticDate: "2018", //日期
                        ticTime: "13.14", //时间
                        ticBanClass: "YHGDGZ1120", //班次
                        ticSeat: "2", //座位
                        ticStyle: "全票", //票型
                        ticPrice: "70.00", //票价
                        ticsTayion: "广州（省站" //站点
                    },
                    {
                        sequence: "1", //序号
                        ticDate: "2018", //日期
                        ticTime: "13.14", //时间
                        ticBanClass: "YHGDGZ1120", //班次
                        ticSeat: "2", //座位
                        ticStyle: "全票", //票型
                        ticPrice: "70.00", //票价
                        ticsTayion: "广州（省站" //站点
                    }
                ],
                objDataShow: [],
                ticPage: {
                    pageSizes: [10, 20, 30, 40], //分页信息 pageSize
                    total: 20, //总页数 totalRow
                    currentPage: 1, //当前第几页 pageNumber
                    pageSize: 10 //每一页加载多少条数据
                },
                ticDataShowPage: {
                    pageSizes: [10], //分页信息 pageSize
                    total: 20, //总页数 totalRow
                    currentPage: 1, //当前第几页 pageNumber
                    pageSize: 10 //每一页加载多少条数据
                },
                dataForm: {
                    page: true,
                    highlightCurrentRow: true,
                    align: "center",
                    addBtn: false, //是否添加按钮
                    delBtn: false, //是否添加删除按钮
                    editBtn: false, //是否添加编辑按钮
                    menu: false, //是否添加菜单按钮
                    column: [
                        {
                            label: "",
                            prop: "sequence"
                        },
                        {
                            label: "日期",
                            prop: "ticDate"
                        },
                        {
                            label: "时间",
                            prop: "ticTime"
                        },
                        {
                            label: "班次",
                            prop: "ticBanClass"
                        },
                        {
                            label: "座位",
                            prop: "ticSeat"
                        },
                        {
                            label: "票型",
                            prop: "ticStyle"
                        },
                        {
                            label: "票价",
                            prop: "ticPrice"
                        },
                        {
                            label: "站点",
                            prop: "ticsTayion"
                        }
                    ]
                },
                dataDataShowForm: {
                    page: false,
                    highlightCurrentRow: true,
                    align: "center",
                    addBtn: false, //是否添加按钮
                    delBtn: false, //是否添加删除按钮
                    editBtn: false, //是否添加编辑按钮
                    menu: false, //是否添加菜单按钮
                    column: [
                        {
                            label: "线路",
                            prop: "linename"
                        },
                        {
                            label: "班次",
                            prop: "ticDClass"
                        },
                        {
                            label: "时间",
                            prop: "ticDTime"
                        },
                        {
                            label: "售价",
                            prop: "price"
                        },
                        {
                            label: "已售",
                            prop: "ticDhasSell"
                        },
                        {
                            label: "余座",
                            prop: "ticDSeat"
                        },
                        {
                            label: "状态",
                            prop: "ticDStatus"
                        },
                        {
                            label: "类型",
                            prop: "ticDStyle"
                        },
                        {
                            label: "车牌号码",
                            prop: "ticDCarNum"
                        },
                        {
                            label: "里程",
                            prop: "ticDMileage"
                        },
                        {
                            label: "需时",
                            prop: "ticDHasTime"
                        },
                        {
                            label: "车型",
                            prop: "ticDCarStyle"
                        }
                    ]
                },
                restaurants: [],
                resStation: [],
                buPiaoArr: [],
                endStation: "",
                endorseStation: "",
                halfTic: "",
                makeCollec: "",
                freeChil: "",
                returnTic: "",
                fullTic: "",
                receivable: "",
                reback: "",
                ticModal: false,
                // ticModal: true,
                tagDateVal: "",
                tagDateEndorse: "",
                dateValue: "",
                classOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "乘车日期",
                            prop: "date",
                            type: "date",
                            span: 10
                        },
                        {
                            label: "到站",
                            prop: "endSta",
                            type: "select",
                            dicData: "station",
                            span: 9
                        },
                        {
                            label: "免费儿童",
                            prop: "freeChild",
                            span: 6
                        },
                        {
                            label: "半票",
                            prop: "half",
                            span: 6
                        },
                        {
                            label: "收款",
                            prop: "price",
                            span: 6
                        },
                        {
                            label: "应找",
                            prop: "backPrice",
                            span: 6
                        },
                        {
                            label: "景点套票",
                            prop: "taoTicket",
                            span: 6
                        },
                        {
                            label: "全票",
                            prop: "fullTicket",
                            span: 6
                        },
                        {
                            label: "应收",
                            prop: "getPrice",
                            span: 6
                        }
                    ]
                },
                buyTicOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "到站",
                            prop: "endStations",
                            type: "select",
                            dicData: "stations",
                            span: 16
                        }
                        /*{
                                          label: "免费儿童",
                                          prop: "freeChild",
                                          span: 6
                                      },
                                      {
                                          label: "半票",
                                          prop: "half",
                                          span: 6
                                      },
                                      {
                                          label: "收款",
                                          prop: "price",
                                          span: 6
                                      },
                                      {
                                          label: "应找",
                                          prop: "backPrice",
                                          span: 6
                                      },
                                      {
                                          label: "全票",
                                          prop: "fullTicket",
                                          span: 6
                                      },
                                      {
                                          label: "应收",
                                          prop: "getPrice",
                                          span: 6
                                      }*/
                    ]
                },
                msgList: [
                    {
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],
                detailsList: [
                    {
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],
                modualShow: false,
                modalTitle: "",
                getTicket: {},
                getOption: {
                    dicData: DIC,
                    submitText: "完成",
                    expand: true,
                    column: [
                        {
                            label: "订单号码",
                            prop: "ticNum",
                            span: 8
                        },
                        {
                            label: "订单状态",
                            prop: "ticSta",
                            type: "select",
                            dicData: "ticSta",
                            span: 8
                        },
                        {
                            label: "购票日期",
                            prop: "buyDate",
                            type: "daterange",
                            span: 8
                        },
                        {
                            label: "证件号码",
                            prop: "IDnum",
                            span: 8
                        },
                        {
                            label: "手机号码",
                            prop: "price",
                            span: 8
                        },
                        {
                            label: "班次日期",
                            prop: "classDate",
                            type: "date",
                            span: 8
                        }
                    ]
                },
                TicketTable: [
                    {
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],
                payTable: [
                    {
                        page: {
                            pageSizes: [10, 20, 30, 40],
                            total: 2,
                            currentPage: 1,
                            pageSize: 10
                        },
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],
                sellTable: [
                    {
                        page: {
                            pageSizes: [10, 20, 30, 40],
                            total: 2,
                            currentPage: 1,
                            pageSize: 10
                        },
                        data: [],
                        option: {
                            highlightCurrentRow: true,
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],
                sellSum: {},
                sumOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "班次日期",
                            prop: "classTime",
                            type: "date"
                        }
                    ]
                },
                abanTicket: "first",
                backTicOnDuan: {},
                backTicODOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "起始票号",
                            prop: "startTicket",
                            span: 6
                        },
                        {
                            label: "结束票号",
                            prop: "endTicket",
                            span: 6
                        },
                        {
                            label: "退票费率",
                            prop: "backPer",
                            span: 6
                        }
                    ]
                },
                tuiObj: {},
                backDuanTable: [
                    {
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],
                backTicOnClass: {},
                backTicCOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "班次日期",
                            prop: "startTicket",
                            type: "date",
                            span: 24
                        },
                        {
                            label: "班次号",
                            prop: "classID",
                            span: 6
                        },
                        {
                            label: "座位号",
                            prop: "seatID",
                            span: 6
                        },
                        {
                            label: "退票费率",
                            prop: "backPer",
                            span: 6
                        }
                    ]
                },
                abanTicOnDuan: {},
                abanTicODOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "起始票号",
                            prop: "startTicket",
                            span: 6
                        },
                        {
                            label: "结束票号",
                            prop: "endID",
                            span: 6
                        }
                    ]
                },
                abanOnClass: {},
                abanTicCOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "起始票号",
                            prop: "startTicket",
                            type: "date",
                            span: 6
                        },
                        {
                            label: "班次号",
                            prop: "classID",
                            span: 6
                        },
                        {
                            label: "座号",
                            prop: "seatID",
                            span: 6
                        }
                    ]
                },
                searchInput: "",
                searchID: {no_bc: "00109"},
                saleTicket: {},
                saleTicOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "类型",
                            prop: "ticType",
                            type: "select",
                            dicData: "",
                            span: 12
                        },
                        {
                            label: "数量",
                            prop: "ticCount",
                            span: 6
                        },
                        {
                            label: "姓名",
                            prop: "name",
                            span: 8
                        },
                        {
                            label: "电话号码",
                            prop: "name",
                            span: 8
                        },
                        {
                            label: "性别",
                            prop: "name",
                            type: "select",
                            dicData: "sex",
                            span: 6
                        },
                        {
                            label: "证件号",
                            prop: "ID",
                            span: 20
                        }
                    ]
                },
                saleTicketII: {},
                saleTicOptionII: {
                    dicData: DIC,
                    column: [
                        {
                            label: "应收",
                            prop: "collect",
                            span: 8
                        },
                        {
                            label: "面值",
                            prop: "monValue",
                            span: 8
                        },
                        {
                            label: "数量",
                            prop: "count",
                            span: 8
                        },
                        {
                            label: "实收",
                            prop: "monGet",
                            span: 8
                        },
                        {
                            label: "面值",
                            prop: "monValue",
                            span: 8
                        }
                    ]
                },
                currentRow: ""
            };
        },
        methods: {
            getticDuanList() {
                this.postRequest("/tks/sale/getAvaliableTks").then(data => {
                    this.ticDuanList = data.data;
                });
            },
            getTicPrintList() {
                this.postRequest("/print/tempalate/printers", {
                    type: "客运车票"
                }).then(data => {
                    console.log(data);
                    this.ticPrintList = data.data;
                });
            },
            sure() {
                this.printWin = false;
            },
            /**  补票  S**/
            dtToJson(text) {
                var nodeEle = document.createElement("div");
                nodeEle.innerHTML = text;

                //根据格式获取
                var arr = nodeEle.querySelectorAll("td") || [];

                var ret = [];
                arr.forEach(tmp => {
                    let item = {};
                    for (let attr of tmp.attributes) {
                        item[attr.name] = attr.value;
                    }
                    ret.push(item);
                });
                console.log(ret);
                return ret;
            },
            getTime() {
                var dates = new Date();
                var Y = dates.getFullYear() + "-";
                var M =
                    (dates.getMonth() + 1 < 10
                        ? "0" + (dates.getMonth() + 1)
                        : dates.getMonth() + 1) + "-";
                var D = dates.getDate() + " ";
                this.dateValue = Y + M + D;
                this.endorseValue = Y + M + D;
            },
            closeTicModal() {
                this.ticModal = false;
                this.modalPosition = false;
                this.endorseModal = false;
                this.ticEndorse = false;
                this.modualShow = false;
                this.endStation = "";
                this.endorseStation = "";
                this.getTime();
            },
            getDateInfo() {
                this.getTime();
                this.postRequest(
                    "/tks/sale/getDateInfo?theday=" + this.dateValue + ""
                ).then(target => {
                    // console.log(target);
                    var tag = target.data;
                    this.tagDateVal = tag.chineseDate + "  " + tag.week;
                    this.tagDateEndorse = tag.chineseDate + "  " + tag.week;
                });
            },
            toBuyTic() {
                this.modalPosition = true;
                this.ticModal = true;
            },
            rowChangeTic(val) {
                console.log(val);
                this.page.currentPage = val;
            },
            rowChangeData(val) {
                console.log(val);
                this.page.currentPage = val;
            },
            queryCardCode(queryString, cb) {
                var cardrestaurants = this.restaurants;
                var results = queryString
                    ? cardrestaurants.filter(this.createFilter(queryString))
                    : cardrestaurants;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            queryCardStation(queryString, cb) {
                var resStations = this.resStation;
                var results = queryString
                    ? resStations.filter(this.createFilter(queryString))
                    : resStations;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            createFilter(queryString) {
                return restaurant => {
                    return (
                        restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
                        0
                    );
                };
            },
            loadAll() {
                return [];
            },
            //获取到站 数据
            saleStations() {
                this.postRequest("/tks/sale/saleStations?sortOrder=code%2Cspell").then(
                    target => {
                        console.log("********");
                        console.log(target.data);
                        console.log("********");
                        var tag = target.data;
                        this.restaurants = [];
                        this.resStation = [];
                        for (var i = 0; i < tag.length; i++) {
                            this.restaurants.push({
                                value: tag[i].name + "[" + tag[i].id + "]"
                            });
                            this.resStation.push({
                                value: tag[i].name + "[" + tag[i].id + "]"
                            });
                        }
                    }
                );
            },
            /**  补票  E**/

            /**  改签  S**/
            toEndorse() {
                this.ticModal = false;
                this.modalPosition = false;
                this.endorseModal = true;
                this.ticEndorse = true;
            },
            submit() {
                if (this.endorseNum === "") {
                    this.$message.error("请填写票号");
                } else {
                    //测试  00110
                    this
                        .getRequest("/tks/sale/get?no_bc=" + this.endorseNum + "")
                        .then(targrt => {
                            console.log(targrt);
                            var tag = targrt.data[1];
                            if (tag !== "") {
                                for (var i = 0; i < tag.length; i++) {
                                    this.endorsePrice = tag[i].price;
                                    this.ticket_id = tag[i].ticket_id;
                                    this.tbc_bus_date = tag[i].tbc_bus_date;
                                    this.tbc_bus_id = tag[i].tbc_bus_id;
                                    this.seatno = tag[i].seatno;
                                }
                            }
                            this.objDataShow = targrt.data[1];
                        });
                }
            },
            sureEndorse() {
                if (this.endorseSeat === "") {
                    this.$message.error("请填写改签座位号");
                } else {
                    // this.$http.get('/tks/reset/doReset?ticket_id='+this.ticket_id+'&dest_bus_plan_id=1635584&seatno='+this.seatno+'')
                    this
                        .getRequest(
                            "/tks/reset/doReset?ticket_id=" + this.endorseNum + "&dest_bus_plan_id=" + this.endorseStation.slice(this.endorseStation.indexOf("[") + 1, this.endorseStation.indexOf("]")) + "&seatno=" + this.endorseSeat
                        )
                        .then(targrt => {
                            console.log(targrt);
                            var tag = targrt.data[0];
                            console.log(tag);
                            if (tag == -1) {
                                this.$message.warning(targrt.data[1]);
                            } else {
                                this.$message.success(targrt.data[1]);
                            }
                        });
                }
            },
            /**  改签  E**/

            stationDIC() {
                this.postRequest("/tks/sale/saleStations?sortOrder=code%2Cspell").then(
                    data => {
                        for (var item of data.data) {
                            DIC.station.push({
                                label: item.sttext,
                                value: item.id
                            });
                        }
                    }
                );
            },
            getMsgList() {
                this.msgList[0].data = [];
                this.postRequest("/tks/sale/dailyDetail").then(data => {
                    for (var item of data.data.list) {
                        this.msgList[0].data.push({
                            bus_date: item.bus_date,
                            bus_time: item.bus_time,
                            busid: item.busid,
                            seatno: item.seatno,
                            pricetype: item.pricetype,
                            price: item.price,
                            stname: item.stname
                        });
                    }
                });
            },
            tableCreate() {
                this.msgList[0].option.column = [];
                this.msgList[0].option.column.push(
                    {
                        label: "日期",
                        prop: "bus_date"
                    },
                    {
                        label: "时间",
                        prop: "bus_time"
                    },
                    {
                        label: "班次",
                        prop: "busid"
                    },
                    {
                        label: "座位",
                        prop: "seatno"
                    },
                    {
                        label: "票型",
                        prop: "pricetype"
                    },
                    {
                        label: "票价",
                        prop: "price"
                    },
                    {
                        label: "站点",
                        prop: "stname"
                    }
                );
            },
            tableIICreate() {
                this.detailsList[0].option.column = [];
                this.detailsList[0].option.column.push(
                    {
                        label: "线路",
                        prop: "stname"
                    },
                    {
                        label: "班次",
                        prop: "id"
                    },
                    {
                        label: "时间",
                        prop: "bus_time"
                    },
                    {
                        label: "售价",
                        prop: "price"
                    },
                    {
                        label: "已售",
                        prop: "pay_type"
                    },
                    {
                        label: "余座",
                        prop: "seatno"
                    },
                    {
                        label: "状态",
                        prop: "statusname"
                    },
                    {
                        label: "类型",
                        prop: "pricetype"
                    },
                    {
                        label: "车牌号码",
                        prop: "busid"
                    },
                    {
                        label: "里程",
                        prop: "credential_owner"
                    },
                    {
                        label: "需时",
                        prop: "time"
                    },
                    {
                        label: "车型",
                        prop: "boarding_org"
                    }
                );
            },
            getDetailsList() {
                this.detailsList[0].data = [];
                this.postRequest("/tks/sale/dailyDetail").then(data => {
                    for (var item of data.data.list) {
                        this.detailsList[0].data.push({
                            stname: item.stname,
                            id: item.id,
                            bus_time: item.bus_time,
                            price: item.price,
                            pay_type: item.pay_type,
                            seatno: item.seatno,
                            statusname: item.statusname,
                            pricetype: item.pricetype,
                            busid: item.busid,
                            credential_owner: item.credential_owner,
                            time: "",
                            boarding_org: item.boarding_org
                        });
                    }
                });
            },
            closeModual() {
                this.modualShow = false;
            },
            getTicSta() {
                DIC.ticSta = [];
                this.postRequest("/sch/data/common/orderStatus").then(data => {
                    for (var item of data.data) {
                        DIC.ticSta.push({
                            label: item.key,
                            value: item.value
                        });
                    }
                });
            },
            getTicketTable() {
                this.postRequest("/tks/lwticket/queryTicketOrder").then(data => {
                    console.log(data);
                    if (data.data[0] == -1) {
                        this.$message.error(data.data[1]);
                    } else {
                        for (var item of data.data.list) {
                            this.TicketTable[0].data = data.data.list
                        }
                    }
                });
            },
            outTick(sta, dno, id) {
                this.postRequest("/tks/lwticket/takeTickets", {
                    start_station: sta,
                    order_no: dno,
                    "ownerscope.id": id
                }).then(data => {
                    this.msgShow(data, function () {
                    });
                });
            },
            cancel() {
                this.modualShow = false;
            },
            check() {
                this.postRequest("/tks/lwticket/queryTicketOrder", {
                    order_no: this.getTicket.ticNum,
                    order_status: this.getTicket.ticSta,
                    start_date: this.dateToString(this.getTicket.buyDate[0]),
                    start_date: this.dateToString(this.getTicket.buyDate[1]),
                    tk_holder_cert_no: this.getTicket.IDnum,
                    tk_holder_phone: this.getTicket.price,
                    busdate: this.dateToString(this.getTicket.classDate)
                }).then(data => {
                    this.msgShow(data, function () {
                    });
                    this.TicketTable[0].data = data.data.list;
                });
            },
            getPayTable() {
                this.payTable[0].data = [];
                this.postRequest("/tks/noncash/order/list").then(data => {
                    console.log(data);
                    this.payTable[0].data = data.data.list;
                });
            },
            PayTableCreate() {
                this.payTable[0].option.column = [];
                this.payTable[0].option.column.push(
                    {
                        label: "金额",
                        prop: "money"
                    },
                    {
                        label: "提交时间",
                        prop: "sendTime"
                    },
                    {
                        label: "支付方式",
                        prop: "payStyle"
                    },
                    {
                        label: "支付时间",
                        prop: "payTime"
                    },
                    {
                        label: "支付单号",
                        prop: "payID"
                    }
                );
            },
            Payrefresh() {
                this.getPayTable();
            },
            checkSum() {
                this.getRequest(
                    "/tks/sale/salesumPage?saledate=" +
                    this.dateToString(this.sellSum.classTime)
                ).then(data => {
                    document.getElementById("sumDIV").innerHTML = data.data;
                });
            },
            getSellTable() {
                this.sellTable[0].data = [];
                this.postRequest("/tks/sale/dailyDetail").then(data => {
                    console.log(data);
                    this.sellTable[0].data = data.data.list
                });
            },
            sellTableCreate() {
                this.sellTable[0].option.column = [];
                this.sellTable[0].option.column.push(
                    {
                        label: "票号",
                        prop: "ticketno"
                    },
                    {
                        label: "出票时间",
                        prop: "create_time"
                    },
                    {
                        label: "支付方式",
                        prop: "paytype_cn"
                    },
                    {
                        label: "票型",
                        prop: "pricetype"
                    },
                    {
                        label: "携童",
                        prop: "is_enfant"
                    },
                    {
                        label: "班次日期",
                        prop: "bus_date"
                    },
                    {
                        label: "座号",
                        prop: "seatno"
                    },
                    {
                        label: "目的地",
                        prop: "stname"
                    },
                    {
                        label: "班次号",
                        prop: "busid"
                    },
                    {
                        label: "状态",
                        prop: "statusname"
                    }
                );
            },
            rePrint() {
                this
                    .getRequest("/tks/sale/reprint?bill_scope_id=" + this.currentRow)
                    .then(data => {
                        if (data.data[0] == "0") {
                            this.$message({
                                message: data.data[1],
                                type: "success"
                            });
                        } else {
                            this.$message.error(data.data[1]);
                        }
                    });
            },
            getBackDTable() {
                this
                    .getRequest(
                        "/tks/refund/getTks?beginno=00109&endno=00109&busid=&busdate=2018-09-06&busseat="
                    )
                    .then(data => {
                        if (data.data[0] == "0") {
                            for (var item of data.data) {
                                this.backDuanTable[0].data = data.data.list
                            }
                        }
                    });
            },
            BackDTableCreate() {
                this.backDuanTable[0].option.column = [];
                this.backDuanTable[0].option.column.push(
                    {
                        label: "票号",
                        prop: "ticketno"
                    },
                    {
                        label: "日期",
                        prop: "bus_date"
                    },
                    {
                        label: "班次",
                        prop: "busid"
                    },
                    {
                        label: "时间",
                        prop: "bus_time"
                    },
                    {
                        label: "座位",
                        prop: "seatno"
                    },
                    {
                        label: "票价",
                        prop: "price"
                    },
                    {
                        label: "状态",
                        prop: "status"
                    },
                    {
                        label: "默认费率",
                        prop: "recommandRetuRate"
                    },
                    {
                        label: "到站",
                        prop: "stname"
                    }
                );
            },
            backTic() {
                console.log(this.backTicId);
                //startTicket endTicket
                if(this.backTicOnDuan.startTicket == '' || this.backTicOnDuan.endTicket == ''){
                    this.$message.error('请填写完票号后按回车');
                }else if(this.backTicOnDuan.backPer == ''){
                    this.$message.error('请填写退票费率');
                }else if(this.backTicId == ''){
                    this.$message.error('请选择一条数据');
                }else{
                    this.getRequest("/tks/refund/doRefund?tks=" +
                        JSON.stringify([
                            {
                                id: this.backTicId,
                                tkPrice: this.backTicPrice,
                                rePrice: this.backTicPrice - this.backTicRate,
                                poundage: this.backTicRetuRate,
                                ratio: this.backTicRate
                            }
                        ]) + "&tkPoundages_sum=" + this.backTicOnDuan.backPer
                    ).then(data => {
                        console.log(data);
                        if(data.data[0] == '-1'){
                            this.$message.error(data.data[1]);
                        }else{
                            this.$message.success(data.data[1]);
                        }
                    });
                }
            },
            babanTic() {
                this.getRequest(
                    "/tks/cancel/doCancel?tkIds=" + this.tuiObj.ticketno[0]
                ).then(data => {
                    this.msgShow(data, function () {
                    });
                });
            },
            closeSearch() {
                this.modalTitle = "";
            },
            handleSearch() {
                this.postRequest("/tks/sale/detailPage", {
                    no_bc: this.searchInput
                }).then(data => {
                    // console.log(data);
                    document.getElementById("checkContent").innerHTML = data.data;
                });
            },
            closeSaleWin() {
                this.modualShow = false;
            },
            sendSale() {
                this.$http
                    .get(
                        "/disc/sale/add?discount_owner_scope_id=2&discountSaleOrder.discount_bill_count=1&discountSaleOrder.customer_phoneno=17724220042&discountSaleOrder.customer_idno=441842599525212578&discountSaleOrder.customer_name=%E5%BC%A0%E6%99%93%E5%B3%B0&discountSaleOrder.customer_sex=%E7%94%B7&discountSaleOrder.amount=21&sale_discount_gathering=100"
                    )
                    .then(data => {
                        if (data.data[0] == 0) {
                            this.$message({
                                message: data.data[1],
                                type: "success"
                            });
                        } else {
                            this.$message.error(data.data[1]);
                        }
                    });
            },
            toGet() {
                this.modualShow = true;
                this.modalTitle = "取票";
                this.getTicketTable();
            },
            toUnCash() {
                this.modualShow = true;
                this.modalTitle = "非现金支付订单";
                this.PayTableCreate();
                this.getPayTable();
            },
            toSell() {
                this.modualShow = true;
                this.modalTitle = "售票明细";
                this.sellTableCreate();
                this.getSellTable();
            },
            toSum() {
                this.modualShow = true;
                this.modalTitle = "售票汇总";
            },
            toBack() {
                this.modualShow = true;
                this.modalTitle = "退票面板";
                this.BackDTableCreate();
                this.getBackDTable();
            },
            toAban() {
                this.modualShow = true;
                this.modalTitle = "废票面板";
                this.BackDTableCreate();
                this.getBackDTable();
            },
            toTicSear() {
                this.modalTitle = "票号查询";
                this.modualShow = false;
            },
            toSaleTic() {
                this.modualShow = true;
                this.modalTitle = "销售优惠券";
            },
            rowChange() {
            },
            rowChange1(val) {
                console.log(val);
                this.backTicId = val.id;
                this.backTicRetuRate = val.recommandRetuRate;
                this.backTicPrice = val.price;//票价
                if(val.refund_fee_rate == null){
                    this.backTicRate = 0;//退票费
                }else{
                    this.backTicRate = val.refund_fee_rate;
                }
            },
            rowChangeSell(val) {
                this.currentRow = val.id;
            },
            quPiao(starSta, dingNum, id) {
                this.postRequest("/tks/lwticket/takeTickets", {
                    start_station: starSta,
                    order_no: dingNum,
                    "ownerscope.id": id
                }).then(data => {
                    this.msgShow(data, function () {
                    })
                })
            },
            getRHTML() {
                alert(1);
            }
        },
        computed: {},
        components: {FormData, TableData},
        watch: {
            endStation(val) {
                // console.log(val);
                // console.log(val.join('()'));
                var tag = val.indexOf("[");
                var tags = val.indexOf("]");
                var valId = val.substring(tag + 1, tags);
                // console.log(valId);
                $("#busList").html("");
                this.postRequest("/tks/sale/buslist", {
                    stid: valId,
                    is_bupiao: 1,
                    // bus_date: '2018-09-06',
                    bus_date: this.dateValue,
                    show_layout: true,
                    org_id: ""
                }).then(target => {
                    console.log(target);
                    // this.dtToJson(target.data);
                    $("#busList").html(target.data);
                    // this.dtToJson(target.data);
                    // $("#busList").append(target.data)
                });
            },
            dateValue() {
                //获取当前的时间和选择的时间
                var dates = new Date();
                var Ys = dates.getFullYear() + "-";
                var Ms =
                    (dates.getMonth() + 1 < 10
                        ? "0" + (dates.getMonth() + 1)
                        : dates.getMonth() + 1) + "-";
                var Ds = dates.getDate() + " ";
                var tagTerday = Ys + Ms + Ds;

                var date = this.dateValue;
                console.log(date);
                var Y = date.getFullYear() + "-";
                var M =
                    (date.getMonth() + 1 < 10
                        ? "0" + (date.getMonth() + 1)
                        : date.getMonth() + 1) + "-";
                var D = date.getDate() + " ";
                var tagDate = Y + M + D;
                if (tagDate < tagTerday) {
                    this.$message({
                        showClose: true,
                        message: "选择的日期只能大于等于今天的噢",
                        type: "error"
                    });
                    this.dateValue = tagTerday;
                } else {
                    // console.log('/tks/sale/getDateInfo?theday=' + tagDate + '');
                    this.postRequest("/tks/sale/getDateInfo?theday=" + tagDate + "").then(
                        target => {
                            // console.log(target);
                            var tag = target.data;
                            this.tagDateVal = tag.chineseDate + "  " + tag.week;
                        }
                    );
                }
            },
            endorseValue() {
                //获取当前的时间和选择的时间
                var dates = new Date();
                var Ys = dates.getFullYear() + "-";
                var Ms =
                    (dates.getMonth() + 1 < 10
                        ? "0" + (dates.getMonth() + 1)
                        : dates.getMonth() + 1) + "-";
                var Ds = dates.getDate() + " ";
                var tagTerday = Ys + Ms + Ds;

                var date = this.endorseValue;
                console.log(date);
                var Y = date.getFullYear() + "-";
                var M =
                    (date.getMonth() + 1 < 10
                        ? "0" + (date.getMonth() + 1)
                        : date.getMonth() + 1) + "-";
                var D = date.getDate() + " ";
                var tagDate = Y + M + D;
                if (tagDate < tagTerday) {
                    this.$message({
                        showClose: true,
                        message: "选择的日期只能大于等于今天的噢",
                        type: "error"
                    });
                    this.endorseValue = tagTerday;
                } else {
                    // console.log('/tks/sale/getDateInfo?theday=' + tagDate + '');
                    this.postRequest("/tks/sale/getDateInfo?theday=" + tagDate + "").then(
                        target => {
                            // console.log(target);
                            var tag = target.data;
                            this.tagDateEndorse = tag.chineseDate + "  " + tag.week;
                        }
                    );
                }
            }
        },
        mounted() {
            this.getticDuanList();
            this.getTicPrintList();
            this.getDateInfo();
            this.saleStations();
            this.restaurants = this.loadAll();
            this.$emit("sendTag", 1);
            this.stationDIC();
            this.tableCreate();
            this.tableIICreate();
            this.getMsgList();
            this.getDetailsList();
            this.getTicSta();
            var that = this;
            $(".backTic").bind("keyup", function (event) {

                if (event.keyCode == "13") {
                    if(that.backTicOnDuan.startTicket === '' ||  that.backTicOnDuan.endTicket === ''){
                        that.$message.error('请填写票号');
                        return false;
                    }
                    that.getRequest(
                        "/tks/refund/getTks?beginno=" +
                        that.backTicOnDuan.startTicket +
                        "&endno=" +
                        that.backTicOnDuan.endTicket +
                        "&busid=&busdate=&busseat="
                    ).then(data => {
                        console.log(data);

                        if(data.data[0] == '-1'){
                            that.$message.error(data.data[1]);
                        }else{
                            that.backDuanTable[0].data = data.data[1];
                        }

                        if(data.data[1].length == 1){
                            this.backTicPrice = (data.data[1])[0].price;
                            // console.log(this.backTicId);
                        }else{
                            that.$message.success('请选择一条数据再点击退票按钮');
                        }
                    });
                }
            });

            $("#msgForm").bind("keyup", function (event) {
                if (event.keyCode == "13") {
                    that.postRequest("/tks/sale/buslist", {
                        tid: that.classMsg.endSta,
                        is_bupiao: 0,
                        bus_date: that.dateToString(that.classMsg.date),
                        show_layout: true,
                        // org_id:
                    }).then(data => {
                        //   console.log(data);
                        $(".left-table").html(data.data);
                    })
                }
            });
            $("#tuiForm").bind("keyup", function (event) {
                if (event.keyCode == "13") {
                    that.getRequest("/tks/refund/getTks?beginno=" + that.backTicOnDuan.startTicket + "&endno=" + that.backTicOnDuan.endTicket + "&busid=&busdate=" + that.dateToString(that.backTicOnClass.startTicket) + "&busseat=").then(data => {
                        that.backDuanTable[0].data = data.data[1];
                        that.msgShow(data, function () {
                        });
                    })
                }
            });
            $("#feiForm").bind("keyup", function (event) {
                if (event.keyCode == "13") {
                    that.getRequest("/tks/cancel/getTks?beginno=" + that.abanTicOnDuan.startTicket + "&endno=" + that.abanTicOnDuan.endID + "&busdate=&busid=&busseat=").then(data => {
                        that.backDuanTable[0].data = data.data;
                        that.msgShow(data, function () {
                        })
                    })
                }
            });

        }
    };
</script>
<style scoped src="../../assets/css/sell/sell.css">
</style>
<style scoped>
    .el-date-editor > input {
        color: #009688 !important;
    }
</style>